this.BX=this.BX||{};this.BX.Landing=this.BX.Landing||{};this.BX.Landing.UI=this.BX.Landing.UI||{};(function(e,t,i,n,a,r,l,o,s,u,c,d,p,g,f,m,L,I,h,b,v,T){"use strict";var _,y;var E=function(e){babelHelpers.inherits(t,e);function t(e){var i;babelHelpers.classCallCheck(this,t);i=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this,e));i.setEventNamespace("BX.Landing.UI.Field.FieldsListField.RequisiteSettingsField");i.subscribeFromOptions(e.events);v.Dom.replace(i.input,i.getSettingsLayout());return i}babelHelpers.createClass(t,[{key:"getOptions",value:function e(){return this.options}},{key:"getSettingsLayout",value:function e(){var t=this;return this.cache.remember("settingsLayout",(function(){return v.Tag.render(_||(_=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="landing-ui-field-requisite-settings">\n\t\t\t\t\t',"\n\t\t\t\t</div>\n\t\t\t"])),babelHelpers.toConsumableArray(t.getCheckboxTree().keys()).map((function(e){return e.layout})))}))}},{key:"getCheckboxTree",value:function e(){var t=this;return this.cache.remember("checkboxTree",(function(){var e=t.getOptions().value;return e.reduce((function(e,i){var n=new BX.Landing.UI.Field.Checkbox({selector:"".concat(i.id,"_fields"),compact:true,items:i.fields.map((function(e){return{name:e.label,value:e.name,checked:e.disabled!==false}})),onChange:function e(){t.emit("onChange")}});var a=function e(t){t.preventDefault();t.stopPropagation();if(!l.layout.contains(n.layout)){v.Dom.append(n.layout,l.layout)}else{v.Dom.remove(n.layout)}};var r=v.Tag.render(y||(y=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t<span \n\t\t\t\t\t\tclass="ui-link ui-link-dashed"\n\t\t\t\t\t\tonclick="','"\n\t\t\t\t\t>\n\t\t\t\t\t\t',"\n\t\t\t\t\t</span>\n\t\t\t\t"])),a,v.Loc.getMessage("LANDING_FIELDS_ITEM_REQUISITE_SETTINGS_FIELDS_LABEL"));var l=new BX.Landing.UI.Field.Checkbox({selector:i.id,compact:true,items:[{name:i.label,value:i.id,checked:i.disabled!==false}],onChange:function e(){t.emit("onChange");var i=l.layout.querySelector(".landing-ui-field-checkbox-item-label");if(l.getValue().length>0){v.Dom.append(r,i)}else{v.Dom.remove(r);v.Dom.remove(n.layout)}}});if(i.disabled!==false){var o=l.layout.querySelector(".landing-ui-field-checkbox-item-label");v.Dom.append(r,o)}e.set(l,n);return e}),new Map)}))}},{key:"getValue",value:function e(){var t=this;var i=babelHelpers.toConsumableArray(this.getCheckboxTree().entries());return i.reduce((function(e,i,n){var a=babelHelpers.slicedToArray(i,2),r=a[0],l=a[1];var o=l.getValue();e.push({id:r.selector,disabled:r.getValue().length===0,fields:t.getOptions().value[n].fields.map((function(e){return{name:e.name,disabled:!o.includes(e.name)}}))});return e}),[])}}]);return t}(T.BaseField);var F,D;function C(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function S(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?C(Object(i),!0).forEach((function(t){babelHelpers.defineProperty(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):C(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function A(e,t){P(e,t);t.add(e)}function P(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}function N(e,t,i){if(!t.has(e)){throw new TypeError("attempted to get private field on non-instance")}return i}var O=new WeakSet;var k=function(e){babelHelpers.inherits(t,e);function t(e){var a;babelHelpers.classCallCheck(this,t);a=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this,e));A(babelHelpers.assertThisInitialized(a),O);a.setEventNamespace("BX.Landing.UI.Field.FieldsListField");a.setLayoutClass("landing-ui-field-fields-list");a.onSelectFieldButtonClick=a.onSelectFieldButtonClick.bind(babelHelpers.assertThisInitialized(a));a.onSelectProductsButtonClick=a.onSelectProductsButtonClick.bind(babelHelpers.assertThisInitialized(a));a.onSelectSeparatorButtonClick=a.onSelectSeparatorButtonClick.bind(babelHelpers.assertThisInitialized(a));a.onItemRemove=a.onItemRemove.bind(babelHelpers.assertThisInitialized(a));a.onItemEdit=a.onItemEdit.bind(babelHelpers.assertThisInitialized(a));a.onDragEnd=a.onDragEnd.bind(babelHelpers.assertThisInitialized(a));a.onFormChange=a.onFormChange.bind(babelHelpers.assertThisInitialized(a));a.items=[];a.options.items.forEach((function(e){a.addItem(e)}));a.actionPanel=new l.ActionPanel({renderTo:a.layout,left:[{id:"selectField",text:i.Loc.getMessage("LANDING_FIELDS_ADD_FIELD_BUTTON_TITLE"),onClick:a.onSelectFieldButtonClick}],right:[{id:"addProducts",text:i.Loc.getMessage("LANDING_FIELDS_SELECT_PRODUCTS_BUTTON_TITLE"),onClick:a.onSelectProductsButtonClick},{id:"selectSeparator",text:i.Loc.getMessage("LANDING_FIELDS_SELECT_SEPARATOR_BUTTON_TITLE"),onClick:a.onSelectSeparatorButtonClick}]});a.draggable=new n.Draggable({context:window.parent,container:a.getListContainer(),draggable:".landing-ui-component-list-item",dragElement:".landing-ui-button-icon-drag",type:n.Draggable.MOVE,offset:{y:-62}});a.draggable.subscribe("end",a.onDragEnd);return a}babelHelpers.createClass(t,[{key:"createInput",value:function e(){return this.getListContainer()}},{key:"getCrmFieldById",value:function e(t){return Object.values(this.options.crmFields).reduce((function(e,t){return[].concat(babelHelpers.toConsumableArray(e),babelHelpers.toConsumableArray(t.FIELDS))}),[]).find((function(e){return e.name===t}))}},{key:"getCrmFieldCategoryById",value:function e(t){return this.options.crmFields[t]}},{key:"addItem",value:function e(t){var i=this;return this.createItem(t).then((function(e){i.items.push(e);v.Dom.append(e.getLayout(),i.getListContainer())}))}},{key:"prependItem",value:function e(t){var i=this;return this.createItem(t).then((function(e){i.items.unshift(e);v.Dom.prepend(e.getLayout(),i.getListContainer())}))}},{key:"insertItemAfterIndex",value:function e(t,i){var n=this;return this.createItem(t).then((function(e){n.items.splice(i+1,0,e);v.Dom.insertAfter(e.getLayout(),n.getListContainer().childNodes[i])}))}},{key:"isFieldAvailable",value:function e(t){if(v.Type.isStringFilled(t)){if(t.startsWith("product_")){return true}return v.Type.isPlainObject(this.getCrmFieldById(t))}return false}},{key:"getFieldItemTitle",value:function e(t){if(this.isFieldAvailable(t)){if(t.startsWith("product_")){return i.Loc.getMessage("LANDING_FIELDS_LIST_FIELD_PRODUCTS_TITLE")}var n=this.getCrmFieldById(t);var a=this.getCrmFieldCategoryById(n.entity_name);return"".concat(n.caption," \xb7 ").concat(a.CAPTION)}return""}},{key:"createResourceBookingFieldController",value:function e(t){if(t.type==="resourcebooking"){var i=g.PageObject.getRootWindow();var n=this.getCrmFieldById(t.id);return i.BX.Calendar.ResourcebookingUserfield.initCrmFormFieldController({field:S(S({},t),{},{dict:n,node:v.Tag.render(F||(F=babelHelpers.taggedTemplateLiteral(['<div><div class="crm-webform-resourcebooking-wrap"></div></div>'])))})})}return null}},{key:"createItem",value:function e(n){var a={id:n.id,type:n.type?n.type:"",content:n.content,sourceOptions:S({},n),draggable:true,removable:true,onRemove:this.onItemRemove,onEdit:this.onItemEdit,onFormChange:this.onFormChange,form:this.createFieldSettingsForm(n)};if(!t.isSeparator(n.id)){if(this.isFieldAvailable(n.id)){a.title=this.getFieldItemTitle(n.id);var l=this.getCrmFieldById(n.id);a.description=n.label||(l?l.caption:"");a.editable=true;a.isSeparator=false;a.fieldController=this.createResourceBookingFieldController(n);if(n.editing.supportAutocomplete){var o=new b.IconButton({id:"autocomplete",type:function(){if(n.autocomplete){return b.IconButton.Types.user1Active}return b.IconButton.Types.user1}(),style:{opacity:1,cursor:"default"},title:function(){if(n.autocomplete){return i.Loc.getMessage("LANDING_FIELDS_ITEM_AUTOCOMPLETE_ENABLED")}return i.Loc.getMessage("LANDING_FIELDS_ITEM_AUTOCOMPLETE_DISABLED")}()});a.form.subscribe("onChange",(function(e){if(e.getTarget().serialize().autocomplete){o.setType(b.IconButton.Types.user1Active)}else{o.setType(b.IconButton.Types.user1)}}));a.actions=[o]}var s=new r.ListItem(a);if(a.fieldController){return new Promise((function(e){if(v.Type.isFunction(a.fieldController.subscribe)){a.fieldController.subscribe("afterInit",(function(t){n.booking.settings_data=t.getData().settings.data;e(s)}))}else{e(s)}}))}return Promise.resolve(s)}a.editable=false;a.isSeparator=false;a.title="";a.description=i.Loc.getMessage("LANDING_FIELDS_ITEM_FIELD_UNAVAILABLE");a.error=true;var u=new r.ListItem(a);return Promise.resolve(u)}a.isSeparator=true;a.editable=!String(n.id).startsWith("hr_");a.title=t.getSeparatorTitle(n.id);if(v.Type.isString(n.label)){a.description=n.label}else if(String(n.id).startsWith("hr_")){a.description=t.getSeparatorTitle(n.id)}else{var c=this.getCrmFieldById(n.id);if(v.Type.isPlainObject(c)&&v.Type.isString(c.caption)){a.description=c.caption}else{a.description=""}}var d=new r.ListItem(a);return Promise.resolve(d)}},{key:"createCustomPriceDropdown",value:function e(t){return new BX.Landing.UI.Field.Dropdown({id:"customPrice",selector:"customPrice",items:[{name:i.Loc.getMessage("LANDING_FIELDS_LIST_FIELD_PRODUCTS_ALLOW_CUSTOM_PRICE_NOT_SELECTED"),value:null}].concat(babelHelpers.toConsumableArray(t.items.map((function(e){return{name:e.label,value:e.value}})))),content:t.items.reduce((function(e,t){if(t.changeablePrice&&e===null){return t.value}return e}),null)})}},{key:"createProductDefaultValueDropdown",value:function e(t){var n=new BX.Landing.UI.Field.Dropdown({id:"productDefaultValue",selector:"value",title:i.Loc.getMessage("LANDING_FIELDS_ITEM_FORM_LIST_DEFAULT_VALUE_TITLE"),content:t.value,items:[{label:i.Loc.getMessage("LANDING_FORM_DEFAULT_VALUE_NOT_SELECTED"),value:null}].concat(babelHelpers.toConsumableArray(t.items)).map((function(e){return{name:e.label,value:e.value}}))});if(t.items.length>0){n.enable()}else{n.disable()}return n}},{key:"createDefaultValueField",value:function e(t){return new BX.Landing.UI.Field.Dropdown({selector:"value",title:i.Loc.getMessage("LANDING_FIELDS_ITEM_FORM_LIST_DEFAULT_VALUE_TITLE"),content:t.value,items:[{label:i.Loc.getMessage("LANDING_FORM_DEFAULT_VALUE_NOT_SELECTED"),value:null}].concat(babelHelpers.toConsumableArray(t.items)).map((function(e){return{name:e.label,value:e.value}}))})}},{key:"createFieldSettingsForm",value:function e(t){var n=this;var a=[];var r=new u.FormSettingsForm({serializeModifier:function e(t){var i=S({},t);if(Reflect.has(t,"label")){i.label=v.Text.decode(t.label)}if(Reflect.has(t,"required")){i.required=t.required.includes("required")}if(Reflect.has(t,"multiple")){i.multiple=t.multiple.includes("multiple")}if(Reflect.has(t,"bigPic")){i.bigPic=t.bigPic.includes("bigPic")}if(Reflect.has(t,"value")&&v.Type.isArrayFilled(t.items)){i.items=i.items.map((function(e){e.selected=t.value===e.value;return e}))}if(Reflect.has(t,"products")){i.items=v.Runtime.clone(t.products);if(!v.Type.isPlainObject(i.editing)){i.editing={}}if(Reflect.has(t,"value")&&v.Type.isArrayFilled(i.items)){i.items.forEach((function(e){e.selected=String(t.value)===String(e.value)}))}i.editing.catalog=v.Runtime.clone(t.products)}if(Reflect.has(t,"valueType")){if(!v.Type.isPlainObject(i.editing)){i.editing={}}if(!v.Type.isPlainObject(i.editing.editable)){i.editing.editable={}}i.editing.editable.valueType=t.valueType}if(v.Type.isArray(t.useCustomPrice)){i.items.forEach((function(e){e.changeablePrice=t.useCustomPrice.includes("useCustomPrice")&&String(e.value)===String(t.customPrice)}));delete i.customPrice;delete i.useCustomPrice}if(v.Type.isArray(t.autocomplete)){i.autocomplete=t.autocomplete.length>0}if(v.Type.isArrayFilled(t.contentTypes)){if(t.contentTypes.includes("any")){i.contentTypes=[]}}if(v.Type.isArray(t.requisite)){i.requisite={presets:t.requisite}}return i}});if(t.type==="product"){a.push(new m.ProductField({title:i.Loc.getMessage("LANDING_FIELDS_LIST_FIELD_PRODUCTS_TITLE2"),selector:"products",items:t.editing.catalog||[],iblockId:this.options.dictionary.catalog.id,onChange:function e(){var i=r.fields.get("customPrice");var a=n.createCustomPriceDropdown(S(S({},t),{},{items:r.serialize().items}));var l=t.items.some((function(e){return e.changeablePrice}));var o=r.fields.get("useCustomPrice");if(l||o.getValue().includes("useCustomPrice")){v.Dom.style(a.getLayout(),"display",null)}else{v.Dom.style(a.getLayout(),"display","none")}a.setValue(i.getValue());r.replaceField(i,a);var s=r.fields.get("productDefaultValue");var u=n.createProductDefaultValueDropdown(S(S({},t),{},{items:r.serialize().items}));r.replaceField(s,u)}}))}if(t.editing.hasLabel){a.push(new o.TextField({selector:"label",title:i.Loc.getMessage("LANDING_FIELDS_ITEM_FORM_LABEL_FIELD_TITLE"),content:t.label,textOnly:true}))}if(t.type==="rq"){a.push(new E({selector:"requisite",title:i.Loc.getMessage("LANDING_FIELDS_ITEM_REQUISITE_SETTINGS_LABEL"),value:t.requisite.presets}))}if(t.editing.canBeRequired){a.push(new BX.Landing.UI.Field.Checkbox({selector:"required",compact:true,items:[{name:i.Loc.getMessage("LANDING_FIELDS_ITEM_FORM_REQUIRED_FIELD_TITLE"),value:"required"}],value:t.required?["required"]:[]}))}if(t.editing.canBeMultiple){a.push(new BX.Landing.UI.Field.Checkbox({selector:"multiple",compact:true,items:[{name:i.Loc.getMessage("LANDING_FIELDS_ITEM_FORM_MULTIPLE_FIELD_TITLE"),value:"multiple"}],value:t.multiple?["multiple"]:[]}))}if(t.editing.hasStringDefaultValue){a.push(new o.TextField({selector:"value",title:i.Loc.getMessage("LANDING_FIELDS_ITEM_FORM_DEFAULT_VALUE_FIELD_TITLE"),content:t.value,textOnly:true}))}if(t.type==="product"){a.push(new BX.Landing.UI.Field.Checkbox({selector:"bigPic",compact:true,items:[{name:i.Loc.getMessage("LANDING_FIELDS_LIST_FIELD_PRODUCTS_SHOW_BIG_PICTURE"),value:"bigPic"}],value:t.bigPic?["bigPic"]:[]}));var l=t.items.some((function(e){return e.changeablePrice}));var s=this.createCustomPriceDropdown(t);if(l){v.Dom.style(s.getLayout(),"display",null)}else{v.Dom.style(s.getLayout(),"display","none")}a.push(new BX.Landing.UI.Field.Checkbox({id:"useCustomPrice",selector:"useCustomPrice",compact:true,items:[{name:i.Loc.getMessage("LANDING_FIELDS_LIST_FIELD_PRODUCTS_ALLOW_CUSTOM_PRICE"),value:"useCustomPrice"}],value:l?["useCustomPrice"]:[],onChange:function e(t){if(t instanceof T.BaseField){var i=r.fields.get("customPrice");if(t.getValue().includes("useCustomPrice")){v.Dom.style(i.getLayout(),"display",null)}else{v.Dom.style(i.getLayout(),"display","none")}}}}));a.push(s);a.push(this.createProductDefaultValueDropdown(t))}if(["list","radio","checkbox"].includes(t.type)&&t.editing.items.length>0){var c=this.createDefaultValueField(t);var p=new d.ListSettingsField({selector:"items",title:i.Loc.getMessage("LANDING_FIELDS_ITEM_FORM_LIST_SETTINGS_TITLE"),items:function(){return t.editing.items.map((function(e){var i=t.items.find((function(t){return String(t.value)===String(e.id)}));var n=!!i;return{name:n?i.label:e.value,value:e.id,checked:n}}))}()});p.subscribe("onChange",(function(){var e=r.fields.find((function(e){return e.selector==="value"}));r.replaceField(e,n.createDefaultValueField(S(S({},t),{},{items:r.serialize().items,value:e.getValue()})))}));a.push(p);a.push(c)}if(v.Type.isPlainObject(t.editing)&&v.Type.isArrayFilled(t.editing.valueTypes)){a.push(new BX.Landing.UI.Field.Dropdown({selector:"valueType",title:i.Loc.getMessage("LANDING_FIELDS_ITEM_FORM_VALUE_TYPE"),content:t.editing.editable.valueType,items:t.editing.valueTypes.map((function(e){return{name:e.name,value:e.id}}))}))}if(t.type==="file"&&v.Type.isArrayFilled(this.options.dictionary.contentTypes)){var g=v.Type.isArrayFilled(t.contentTypes)?t.contentTypes:["any"];var f=g;var L=new BX.Landing.UI.Field.Checkbox({selector:"contentTypes",title:i.Loc.getMessage("LANDING_FIELDS_ITEM_FORM_ALLOWED_FILE_TYPE"),value:g,items:[function(){if(i.Loc.hasMessage("LANDING_FIELDS_ITEM_FORM_ALLOWED_ANY_FILE_TYPE")){return{name:i.Loc.getMessage("LANDING_FIELDS_ITEM_FORM_ALLOWED_ANY_FILE_TYPE"),value:"any"}}return undefined}()].concat(babelHelpers.toConsumableArray(this.options.dictionary.contentTypes.map((function(e){var t=e.hint?'<span class="ui-hint" data-hint="'.concat(v.Text.encode(e.hint),'"></span>'):"";return{html:'<span style="display: flex; align-items: center;">'.concat(v.Text.encode(e.name)," ").concat(t,"</span>"),name:"",value:e.id}})))),onValueChange:function e(){var t=L.getValue();if(t.includes("any")){if(f.includes("any")){L.setValue(t.filter((function(e){return e!=="any"})))}else{L.setValue(["any"])}}f=L.getValue()}});BX.UI.Hint.init(L.getLayout());a.push(L)}if(v.Text.toBoolean(t.editing.supportAutocomplete)===true){a.push(new BX.Landing.UI.Field.Checkbox({selector:"autocomplete",compact:true,multiple:false,items:[{name:i.Loc.getMessage("LANDING_FIELDS_ITEM_ENABLE_AUTOCOMPLETE"),html:v.Text.encode(i.Loc.getMessage("LANDING_FIELDS_ITEM_ENABLE_AUTOCOMPLETE"))+'<span \n\t\t\t\t\t\t\t\t\tclass="landing-ui-form-help" \n\t\t\t\t\t\t\t\t\tstyle="margin: 0 0 0 5px;"\n\t\t\t\t\t\t\t\t\tonclick="top.BX.Helper.show(\'redirect=detail&code=14611764\'); return false;"\n\t\t\t\t\t\t\t\t><a href="javascript: void();"></a></span>',value:"autocomplete"}],value:t.autocomplete?["autocomplete"]:false}))}if(v.Text.toBoolean(t.editing.hasHint)===true){a.push(new o.TextField({selector:"hint",title:i.Loc.getMessage("LANDING_FIELDS_ITEM_FORM_FIELD_HINT_TITLE"),content:t.hint,textOnly:true}))}if(v.Text.toBoolean(t.editing.supportHintOnFocus)===true){a.push(new BX.Landing.UI.Field.Checkbox({selector:"hintOnFocus",compact:true,multiple:false,items:[{name:i.Loc.getMessage("LANDING_FIELDS_ITEM_ENABLE_HINT_ON_FOCUS"),value:"hintOnFocus"}],value:t.hintOnFocus?["hintOnFocus"]:false}))}a.forEach((function(e){r.addField(e)}));return r}},{key:"getListContainer",value:function e(){return this.cache.remember("listContainer",(function(){return v.Tag.render(D||(D=babelHelpers.taggedTemplateLiteral(['<div class="landing-ui-field-fields-list-container"></div>'])))}))}},{key:"onSelectFieldButtonClick",value:function e(t){var i=this;t.preventDefault();a.FieldsPanel.getInstance({isLeadEnabled:this.options.isLeadEnabled}).show({disabledFields:this.items.map((function(e){return e.options.id})),allowedTypes:N(this,O,B).call(this)}).then((function(e){if(v.Type.isArrayFilled(e)){i.options.crmFields=a.FieldsPanel.getInstance().getOriginalCrmFields();i.onFieldsSelect(e)}}))}},{key:"onFieldsSelect",value:function e(t){var i=this;var n={fields:t.map((function(e){return{name:e}}))};void this.showLoader();c.FormClient.getInstance().prepareOptions(this.options.formOptions,n).then((function(e){void i.hideLoader();return Promise.all(e.data.fields.map((function(e){return i.addItem(e)})))})).then((function(){i.emit("onChange",{skipPrepare:true})}))}},{key:"getValue",value:function e(){return this.items.map((function(e){return e.getValue()}))}},{key:"onSelectProductsButtonClick",value:function e(t){var i=this;t.preventDefault();var n={fields:[{type:"product"}]};void this.showLoader();c.FormClient.getInstance().prepareOptions(this.options.formOptions,n).then((function(e){void i.hideLoader();var t=e.data.fields.map((function(e){return i.addItem(e)}));Promise.all(t).then((function(){i.emit("onChange",{skipPrepare:true})}))}))}},{key:"onSelectSeparatorButtonClick",value:function e(t){var n=this;t.preventDefault();p.SeparatorPanel.getInstance().show().then((function(e){var t=[e];if(e.type==="page"&&!n.items.find((function(e){return e.options.type==="page"}))){t.push(S({},t[0]))}void n.showLoader();c.FormClient.getInstance().prepareOptions(n.options.formOptions,{fields:t}).then((function(t){void n.hideLoader();var a=Promise.resolve();if(e.type==="page"&&!n.items.find((function(e){return e.options.type==="page"}))){t.data.fields[0].label=i.Loc.getMessage("LANDING_FIELDS_ITEM_PAGE_TITLE").replace("#number#",1);t.data.fields[1].label=i.Loc.getMessage("LANDING_FIELDS_ITEM_PAGE_TITLE").replace("#number#",2);a=Promise.all([n.prependItem(t.data.fields[0]),n.insertItemAfterIndex(t.data.fields[1],1)])}else{t.data.fields.forEach((function(e){var t=e.id.split("_"),r=babelHelpers.slicedToArray(t,1),l=r[0];var o=n.items.filter((function(e){return e.options.id.startsWith(l)})).length;if(l==="page"){e.label=i.Loc.getMessage("LANDING_FIELDS_ITEM_PAGE_TITLE").replace("#number#",o+1)}if(l==="section"){e.label=i.Loc.getMessage("LANDING_FIELDS_ITEM_SECTION_TITLE").replace("#number#",o+1)}if(l==="hr"){e.label=i.Loc.getMessage("LANDING_FIELDS_ITEM_LINE_TITLE").replace("#number#",o+1)}a=n.addItem(e)}))}a.then((function(){n.emit("onChange",{skipPrepare:true})}))}))}))}},{key:"onItemRemove",value:function e(t){this.items=this.items.filter((function(e){return e!==t.getTarget()}));this.emit("onChange",{skipPrepare:true})}},{key:"onItemEdit",value:function e(t){var i=this;var n=t.getTarget(),a=n.options;if(a.fieldController){t.preventDefault();a.fieldController.showSettingsPopup();setTimeout((function(){a.fieldController.settingsPopup.subscribeOnce("onClose",(function(){a.sourceOptions.booking.settings_data=a.fieldController.getSettings().data;var e=a.sourceOptions.booking.settings_data;Object.keys(e).forEach((function(t){if(v.Type.isArray(e[t].value)){e[t].value=e[t].value.join("|")}}));i.emit("onChange",{skipPrepare:true})}))}),1e3)}}},{key:"onFormChange",value:function e(t){this.emit("onChange",{skipPrepare:true});var i=t.getTarget();var n=i.getValue();i.setDescription(n.label)}},{key:"onDragEnd",value:function e(){var t=this;setTimeout((function(){t.items=babelHelpers.toConsumableArray(t.getListContainer().children).map((function(e){var i=v.Dom.attr(e,"data-id");return t.items.find((function(e){return e.options.id===i}))}));t.emit("onChange",{skipPrepare:true})}))}},{key:"getLoader",value:function e(){return this.cache.remember("loader",(function(){return new f.Loader({size:50,mode:"inline",offset:{top:"5px",left:"225px"}})}))}},{key:"showLoader",value:function e(){var t=this.getLoader();var i=this.getListContainer();v.Dom.append(t.layout,i);return t.show(i)}},{key:"hideLoader",value:function e(){var t=this.getLoader();v.Dom.remove(t.layout);return t.hide()}}],[{key:"isSeparator",value:function e(t){if(v.Type.isStringFilled(t)){return t.startsWith("hr")||t.startsWith("section")||t.startsWith("page")}return false}},{key:"getSeparatorTitle",value:function e(t){if(v.Type.isStringFilled(t)){if(t.startsWith("hr")){return i.Loc.getMessage("LANDING_SEPARATOR_SOLID_LINE")}if(t.startsWith("section")){return i.Loc.getMessage("LANDING_SEPARATOR_HEADER")}if(t.startsWith("page")){return i.Loc.getMessage("LANDING_SEPARATOR_PAGE")}}return i.Loc.getMessage("LANDING_FIELDS_LIST_FIELD_SEPARATOR_TITLE")}}]);return t}(T.BaseField);function B(){return["list","string","checkbox","date","text","typed_string","file","datetime","integer","double","enumeration","url","money","boolean","resourcebooking","radio","bool","hr","br","phone","email","page","section"]}e.FieldsListField=k})(this.BX.Landing.UI.Field=this.BX.Landing.UI.Field||{},BX,BX.Landing,BX.UI.DragAndDrop,BX.Landing.UI.Panel,BX.Landing.UI.Component,BX.Landing.UI.Component,BX.Landing.UI.Field,BX.Event,BX.Landing.UI.Form,BX.Crm.Form,BX.Landing.UI.Field,BX.Landing.UI.Panel,BX.Landing,BX,BX.Landing.Ui.Field,BX.Calendar,BX,BX,BX.Landing.UI.Component,BX,BX.Landing.UI.Field);
//# sourceMappingURL=fieldslistfield.bundle.map.js